<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="css/mui.min.css">
		<!--App自定义的css-->
		<!--<link rel="stylesheet" type="text/css" href="../css/app.css" />-->
	</head>

	<body>

		<style>
			.mui-control-content {
				background-color: ;
				min-height: 485px;
			}
			
			.mui-control-content .mui-loading {
				margin-top: 50px;
			}
			
			.right {
				position: absolute;
				right: 3px;
				font-size: 6px;
			}
		</style>
		<header class="mui-bar mui-bar-nav">
			<a href="function.html" class=" mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">资源申请</h1>
			<a href="createresource.html" id="menu" class="mui-icon mui-icon-plusempty mui-pull-right"></a>
		</header>
		<div class="mui-content">
			<div id="slider" class="mui-slider">
				<!--资源的两个类别名称-->
				<div id="sliderSegmentedControl" class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<a class="mui-control-item" href="#item1mobile">
						设备资源
					</a>
					<a class="mui-control-item" href="#item2mobile">
						会议室资源
					</a>
				</div>
				<!--下划线-->
				<div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-6"></div>

				<div class="mui-slider-group">
					<!--设备资源-->
					<div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
						<div id="scroll1" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<div class="mui-loading">
									<div class="mui-spinner">

									</div>
								</div>
							</div>
						</div>
					</div>
					<!--会议室资源-->
					<div id="item2mobile" class="mui-slider-item mui-control-content">
						<div id="scroll2" class="mui-scroll-wrapper">
							<div class="mui-scrol2">
								<div class="mui-loading">
									<div class="mui-spinner">

									</div>
								</div>
							</div>
						</div>
					</div>

				</div>

			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/public.js"></script>
		<script>
			var createBy = localStorage.getItem("employeeid");
			//加载

			mui.plusReady(function() {
				mlist();
			});

			function mlist() {
				mui('.mui-scroll-wrapper').scroll({
					indicators: true //是否显示滚动条
				});
				mload1();
				mload2();
			}
			//交互:设备数据展示
			function mload1() {
				var network = true;
				if(mui.os.plus) {
					mui.plusReady(function() {
						if(plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_NONE) {
							network = false;
						}
					});
				}
				if(network) {
					console.log('网络正常,正在发送请求...');
					mui.ajax({
						url: 'http://113.71.26.27:8080/tpl/function/findequirment',
						async: true,
						type: 'post',
						timeout: 2000,
						data: {
							createBy: createBy
						},
						success: function(data) {
							var tt = "";
							var infoList = data;
							for(var i = 0; i < infoList.length; i++) {
								tt += "<div class='mui-card'><p>名称:" + infoList[i].name + "</p><p>开始时间:" + mmtime(infoList[i].startTime) + "</p><p>结束时间:" + mmtime(infoList[i].endTime) + "</p><p>数量:" + infoList[i].sum + "</p><p>申请原因:" + infoList[i].reason + "</p><p>申请状态:" + infoList[i].state + "</p></div>";
							}
							document.getElementById('item1mobile').querySelector('.mui-scroll').innerHTML = tt;
						}
					});

				} else {
					mui.toast("当前网络不给力，请稍后再试...");
				}

			}

			//交互:会议室数据展示
			function mload2() {
				var network = true;
				if(mui.os.plus) {
					mui.plusReady(function() {
						if(plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_NONE) {
							network = false;
						}
					});
				}
				if(network) {
					console.log('网络正常,正在发送请求...');
					mui.ajax({
						url: 'http://113.71.26.27:8080/tpl/function/findroom',
						async: true,
						type: 'post',
						timeout: 2000,
						data: {
							createBy: createBy
						},
						success: function(data) {
							var tt = "";
							var infoList = data;
							for(var i = 0; i < infoList.length; i++) {
								tt += "<div class='mui-card'><p>名称:" + infoList[i].name + "</p><p>开始时间:" + mmtime(infoList[i].startTime) + "</p><p>结束时间:" + mmtime(infoList[i].endTime) + "</p><p>申请原因:" + infoList[i].reason + "</p><p>申请状态:" + infoList[i].state + "</p></div>";
							}
							document.getElementById('item2mobile').querySelector('.mui-scrol2').innerHTML = tt;
						}
					});
				} else {
					mui.toast("当前网络不给力，请稍后再试...");
				}

			}

			/**
			 * 重写返回事件
			 */
			mui.back = function() {

				window.location.href = "function.html";
			}
		</script>

	</body>

</html>